import { makeAutoObservable } from 'mobx';

export default class SearchStore {
  constructor() {
    makeAutoObservable(this);
  }

  loading = false;

  searchVisible = false;

  searchValue = '';

  showSearch = (isShow, searchValue) => {
    this.searchVisible = !!isShow;
    if (searchValue) {
      this.searchValue = searchValue;
      this.handleSearch();
    }
  };

  hideSearch = () => {
    this.searchVisible = false;
    this.searchValue = '';
  };

  handleSearch = searchValue => {
    const value = searchValue || this.searchValue;
  };
}
